package com.sugar.MultiThread.a08threadmethod5;

/**
 * 让出CPU：交替打印
 * @author felix
 * @date 2025/2/26 09:33
 */
public class ThreadDemo {
    public static void main(String[] args) throws InterruptedException {
        MyThread t1 = new MyThread();
        MyThread t2 = new MyThread();

        t1.setName("土豆");
        t1.start();

        //将线程t1插入到当前线程之前
        //t1:土豆
        //当前线程：main
        t1.join();

        for (int i = 0; i < 10; i++) {
            System.out.println("main线程"+i);
        }
    }
}
